/***************************************
 2010-4-22
****************************************/
package com.happy.services;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.core.orm.hibernate.HibernateDao;
import com.happy.entity.UserInfo;
@Service
@Transactional
public class UserInfoServices {
	/**默认无参构造函数**/
	public UserInfoServices() {
	}
	private HibernateDao<UserInfo, Integer> userDao;


	@Autowired
	public void setSessionFactory(SessionFactory sessionFactory) {
		userDao = new HibernateDao<UserInfo, Integer>(sessionFactory, UserInfo.class);
	}
	public void saveOrUpdate(UserInfo entity)
	{
		userDao.save(entity);
	}
	public UserInfo getByUserId(Integer id)
	{
		return userDao.findUnique("from UserInfo where userId=?", id);
	}
	
}
